/**
 * ATuanZhang
 */
package com.atuanzhang.activity;

import org.huanglei.android.activity.BaseActivity;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.atuanzhang.R;

/**
 * @author huanglei
 * @date 2011-3-25
 * @ 
 */
public class GoodsActivity extends BaseActivity {
	
	private WebView webView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.android_good);
		super.onCreate(savedInstanceState);
		
		initLayout();
		
		initData();
		
	}
	
	private void initData() {
		
	}
	
	private void initLayout() {
		
        Bundle bunde = this.getIntent().getExtras();
        String loc = bunde.getString("loc");
		
		webView=(WebView) this.findViewById(R.id.webview); 
		
		//设置WebView属性，能够执行JavaScript脚本
		webView.getSettings().setJavaScriptEnabled(true);
		webView.loadUrl(loc);
		
        //设置web视图客户端
		webView.setWebViewClient(new MyWebViewClient());

	}


	//web视图客户端
    public class MyWebViewClient extends WebViewClient{
    	public boolean shouldOverviewUrlLoading(WebView view,String url){
    		view.loadUrl(url);
            return true;
    	}
    }
    
  //设置回退
    public boolean onKeyDown(int keyCode,KeyEvent event){
    	
    	 if((keyCode==KeyEvent.KEYCODE_BACK) && webView.canGoBack()) {
    		 	webView.goBack();
                 return true;
         }
    	 
         return super.onKeyDown(keyCode,event);
    }
	
}
